#ifndef FUNCTION_H
#define FUNCTION_H

#include "global.h"

/*
//two activation functions and their derivates
double thresh_Func(double v)
{
	if (v>= f_Thresh)
		return 1.0;
	else return 0.0;

}

double d_thresh_Func(double v)
{
	return 1;
}
*/
//two activation functions and their derivates
static double signum_Func(double v)
{
	if (v> 0)
		return 1.0;
	else if (v< 0)return -1.0;
	return 0;

}

static double d_signum_Func(double v)
{
	if (v == 0)	return 1;
	else return 0;
}

static double logis_Func(double v)
{
	return (1 / (1+exp(-v)));
}


static double d_logis_Func(double v)
{
	return (logis_Func(v)*(1-logis_Func(v)));
}


static double tanh_Func(double v)
{
	if(v > 350) return 1;
	double result = ((exp(2*v) - 1)/(exp(2*v) + 1));
	return result;
}

static double d_tanh_Func(double v)
{
	return (1-pow(tanh_Func(v),2.0));
}
	
#endif
